/* Yammii Merchant Enrichment Demo — widget styles
   All rules are scoped under .yme-widget to avoid clashing with the theme. */

.yme-widget {
	--yme-accent: #0f6e56;
	--yme-accent-soft: #e1f5ee;
	--yme-border: #e2e2e0;
	--yme-border-soft: #ededeb;
	--yme-bg-soft: #f7f6f4;
	--yme-text: #1f2421;
	--yme-text-secondary: #5b6460;
	--yme-text-tertiary: #8a9290;
	--yme-radius: 10px;
	--yme-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	font-family: inherit;
	color: var(--yme-text);
	max-width: 720px;
	margin: 2em auto;
}

.yme-widget * {
	box-sizing: border-box;
}

/* ---- Intro ---- */

.yme-intro {
	border-bottom: 1px solid var(--yme-border-soft);
	padding-bottom: 1em;
	margin-bottom: 1.25em;
}

.yme-eyebrow {
	font-family: var(--yme-mono);
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--yme-accent);
	margin: 0 0 0.4em;
}

.yme-intro h3 {
	margin: 0 0 0.4em;
	font-size: 1.15rem;
	font-weight: 600;
}

.yme-intro p {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.6;
	color: var(--yme-text-secondary);
}

/* ---- Section labels ---- */

.yme-section-label {
	font-family: var(--yme-mono);
	font-size: 0.7rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--yme-text-tertiary);
	margin: 0 0 0.6em;
}

/* ---- Curated example cards ---- */

.yme-curated-list {
	display: grid;
	gap: 0.75em;
	margin-bottom: 1.75em;
}

.yme-card {
	border: 1px solid var(--yme-border);
	border-radius: var(--yme-radius);
	overflow: hidden;
	background: #fff;
}

.yme-card-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75em;
	flex-wrap: wrap;
	padding: 0.9em 1.1em;
	background: var(--yme-bg-soft);
	border-bottom: 1px solid var(--yme-border-soft);
}

.yme-card-title {
	font-weight: 600;
	font-size: 0.98rem;
}

.yme-card-sub {
	font-size: 0.8rem;
	color: var(--yme-text-secondary);
	margin-top: 0.2em;
}

.yme-badges {
	display: flex;
	gap: 0.4em;
	flex-wrap: wrap;
}

.yme-badge {
	font-family: var(--yme-mono);
	font-size: 0.68rem;
	letter-spacing: 0.04em;
	padding: 0.2em 0.7em;
	border-radius: 999px;
	white-space: nowrap;
}

.yme-badge--high {
	background: var(--yme-accent-soft);
	color: var(--yme-accent);
}

.yme-badge--medium {
	background: #faeeda;
	color: #854f0b;
}

.yme-badge--low {
	background: #faece7;
	color: #993c1d;
}

.yme-badge--verified {
	background: var(--yme-accent-soft);
	color: var(--yme-accent);
}

.yme-field-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.yme-field {
	padding: 0.7em 1.1em;
	border-bottom: 1px solid var(--yme-border-soft);
}

.yme-field:nth-child(odd) {
	border-right: 1px solid var(--yme-border-soft);
}

.yme-field-label {
	font-family: var(--yme-mono);
	font-size: 0.68rem;
	color: var(--yme-text-tertiary);
	letter-spacing: 0.03em;
	display: flex;
	align-items: center;
	gap: 0.4em;
	margin-bottom: 0.3em;
}

.yme-field-value {
	font-size: 0.88rem;
	line-height: 1.5;
	word-break: break-word;
}

.yme-field-value.is-null {
	font-family: var(--yme-mono);
	font-size: 0.78rem;
	color: var(--yme-text-tertiary);
}

.yme-field-value a {
	color: var(--yme-accent);
	text-decoration: none;
	word-break: break-all;
}

.yme-field-value a:hover,
.yme-field-value a:focus {
	text-decoration: underline;
}

.yme-source-notes {
	padding: 0.7em 1.1em;
	font-family: var(--yme-mono);
	font-size: 0.74rem;
	line-height: 1.6;
	color: var(--yme-text-tertiary);
	background: var(--yme-bg-soft);
	border-top: 1px solid var(--yme-border-soft);
}

/* Remove the trailing border on the last row pair */
.yme-field-grid .yme-field:nth-last-child(-n+2) {
	border-bottom: none;
}

/* ---- Try it yourself ---- */

.yme-try-toggle {
	font-family: inherit;
	font-size: 0.88rem;
	font-weight: 500;
	color: var(--yme-accent);
	background: none;
	border: 1px solid var(--yme-border);
	border-radius: var(--yme-radius);
	padding: 0.6em 1.1em;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

.yme-try-toggle:hover,
.yme-try-toggle:focus-visible {
	border-color: var(--yme-accent);
}

.yme-try-panel {
	margin-top: 1em;
	padding: 1.1em;
	border: 1px solid var(--yme-border);
	border-radius: var(--yme-radius);
	background: var(--yme-bg-soft);
}

.yme-try-panel[hidden] {
	display: none;
}

.yme-form-row {
	display: flex;
	gap: 0.6em;
	flex-wrap: wrap;
	margin-bottom: 0.5em;
}

.yme-input,
.yme-select {
	font-family: inherit;
	font-size: 0.92rem;
	padding: 0.6em 0.8em;
	border: 1.5px solid var(--yme-border);
	border-radius: 8px;
	background: #fff;
	color: var(--yme-text);
}

.yme-input {
	flex: 1 1 200px;
}

.yme-select {
	flex: 0 0 160px;
}

.yme-input:focus-visible,
.yme-select:focus-visible,
.yme-submit:focus-visible,
.yme-try-toggle:focus-visible {
	outline: 2px solid var(--yme-accent);
	outline-offset: 2px;
}

.yme-submit {
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 500;
	padding: 0.6em 1.3em;
	border: none;
	border-radius: 8px;
	background: var(--yme-accent);
	color: #fff;
	cursor: pointer;
}

.yme-submit:disabled {
	background: var(--yme-border);
	color: var(--yme-text-tertiary);
	cursor: not-allowed;
}

.yme-hint {
	font-size: 0.78rem;
	color: var(--yme-text-tertiary);
	margin: 0.4em 0 0;
}

/* ---- States ---- */

.yme-loading {
	text-align: center;
	padding: 1.4em;
	font-size: 0.85rem;
	color: var(--yme-text-secondary);
	font-family: var(--yme-mono);
}

.yme-loading-dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--yme-accent);
	margin-right: 0.6em;
	animation: yme-pulse 1s ease-in-out infinite;
}

@keyframes yme-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.35; }
}

.yme-message {
	padding: 0.8em 1em;
	border-radius: 8px;
	font-size: 0.85rem;
	line-height: 1.5;
	margin-top: 1em;
}

.yme-message--error {
	background: #faece7;
	color: #993c1d;
}

.yme-message--limit {
	background: #faeeda;
	color: #854f0b;
}

.yme-result {
	margin-top: 1em;
}

/* ---- Responsive ---- */

@media (max-width: 520px) {
	.yme-field-grid {
		grid-template-columns: 1fr;
	}

	.yme-field:nth-child(odd) {
		border-right: none;
	}

	.yme-field-grid .yme-field:nth-last-child(-n+2) {
		border-bottom: 1px solid var(--yme-border-soft);
	}

	.yme-field-grid .yme-field:last-child {
		border-bottom: none;
	}

	.yme-select {
		flex: 1 1 100%;
	}
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
	.yme-loading-dot {
		animation: none;
	}
}
